package com.inmobi.androidsdk;

import android.content.Context;
import android.os.Message;
import com.inmobi.androidsdk.impl.AdException;
import com.inmobi.androidsdk.impl.metric.EventLog;
import com.inmobi.androidsdk.impl.metric.EventType;
import com.inmobi.androidsdk.impl.metric.Logger;
import com.inmobi.androidsdk.impl.net.HttpRequestCallback;
import com.inmobi.androidsdk.impl.net.Response;
import com.inmobi.commons.internal.Log;
import org.json.JSONException;
import org.json.JSONObject;

class c
  implements HttpRequestCallback
{
  c(IMAdView paramIMAdView)
  {
  }

  public void notifyResult(int paramInt, Object paramObject)
  {
    Log.debug("InMobiAndroidSDK_3.7.0", ">>> Got HTTP REQUEST callback. Status: " + paramInt);
    if (paramInt == 0)
    {
      IMAdView.b(this.a, ((Response)paramObject).getAdResponse());
      IMAdView.c(this.a, ((Response)paramObject).getImpressionId());
      IMAdView.t(this.a).sendEmptyMessage(109);
    }
    while (paramInt != 1)
      return;
    long l = System.currentTimeMillis() - IMAdView.d(this.a);
    Message localMessage = IMAdView.t(this.a).obtainMessage(110);
    AdException localAdException;
    IMAdRequest.ErrorCode localErrorCode2;
    JSONObject localJSONObject2;
    if ((paramObject instanceof AdException))
    {
      localAdException = (AdException)paramObject;
      localErrorCode2 = localAdException.getErrorCode();
      if (IMAdView.c(this.a))
        localJSONObject2 = new JSONObject();
    }
    while (true)
    {
      try
      {
        localJSONObject2.put("ad", localAdException.getImpressionId());
        localJSONObject2.put("t", l);
        localJSONObject2.put("m", localAdException.getHttpCode());
        Logger.logEvent(this.a.getContext().getApplicationContext(), new EventLog(EventType.RESPONSE_ERROR, localJSONObject2));
        localErrorCode1 = localErrorCode2;
        localMessage.obj = localErrorCode1;
        localMessage.sendToTarget();
        return;
      }
      catch (JSONException localJSONException2)
      {
        Log.internal("InMobiAndroidSDK_3.7.0", "Error creating metric logs for error at " + System.currentTimeMillis());
        continue;
      }
      IMAdRequest.ErrorCode localErrorCode1 = (IMAdRequest.ErrorCode)paramObject;
      int i = localErrorCode1.getErrorCode();
      if (!IMAdView.c(this.a))
        continue;
      JSONObject localJSONObject1 = new JSONObject();
      try
      {
        localJSONObject1.put("t", l);
        localJSONObject1.put("m", i);
        Logger.logEvent(this.a.getContext().getApplicationContext(), new EventLog(EventType.CONNECT_ERROR, localJSONObject1));
      }
      catch (JSONException localJSONException1)
      {
        while (true)
          Log.internal("InMobiAndroidSDK_3.7.0", "Error creating metric logs for error at " + System.currentTimeMillis());
      }
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.inmobi.androidsdk.c
 * JD-Core Version:    0.6.2
 */